sudo neard -nd "*"
cloudeebus.py -o -d
function gotManager(proxy) { window.nfcManager = proxy; alert("Got Neard NFC Manager"); } function connectSuccess() { cloudeebus.SystemBus().getObject("org.neard", "/", gotManager, window.alert); } cloudeebus.connect("ws://localhost:9000", null, connectSuccess, window.alert)
function gotAdapter(proxy) { window.nfcAdapter = proxy; alert("NFC Adapter ready"); window.nfcAdapter.connected = false; } function gotMgrProps(props) { alert("Found " + props.Adapters.length + " adapters"); if (props.Adapters.length) cloudeebus.SystemBus().getObject("org.neard", props.Adapters[0], gotAdapter, window.alert); } window.nfcManager.GetProperties(gotMgrProps, window.alert);
function onTagRead(props) { alert("Read tag " + props.Type + " with " + props.Records.length + " records."); } function onPropertyChanged(key, table) { if (key == "Tags") { if (table.length) { var tag = cloudeebus.SystemBus().getObject("org.neard", table[0]); tag.callMethod("org.neard.Tag", "GetProperties", [], onTagRead, window.alert); } } } if (!window.nfcAdapter.connected) { window.nfcAdapter.connectToSignal("org.neard.Adapter","PropertyChanged", onPropertyChanged); window.nfcAdapter.connected = true; } window.nfcAdapter.StartPollLoop("Initiator", null, window.alert);